<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/c" prefix="c" %>
<%@ page import="java.text.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="com.solution.webconstant.PermissionConstants" %>
<%
	HashMap permissionMap = ((HashMap)(session.getAttribute("userPermissionsInfo")));
%>
<script language="JavaScript">
function fnUpdate()
{
	document.userForm.screen_type.value="Edit";
	document.userForm.action='/updateUser.do?';
	document.userForm.submit();
}
</script>
<script language="JavaScript" src="js/Calendar.js" type="text/JavaScript"></script>
<html:form action="/user">
	<html:hidden property="screen_type"/>
	<html:hidden property="user_id" />
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  		<tr>
    		<td>
    			<table width="100%" border="0" cellspacing="0" cellpadding="0">
  					<tr>
  						<jsp:include page="userActionTab.jsp"/>	
  					</tr>
				</table>
			</td>
  		</tr>
  		<tr>
    		<td class="formbg" valign="top">
    			<table width="100%" border="0" cellspacing="0" cellpadding="0">
  					<tr>
    					<td>
    						<table width="100%" border="0" cellspacing="4" cellpadding="0">
  								<tr>
    								<td colspan="6"><jsp:include page="showErrorMessage.jsp"/></td>
	
  								</tr>
								<tr>
									<td>&nbsp;</td>
									<td class="formText">First Name<font class="asterix">*</font></td>
									<td><input type="text" name="first_name" id="first_name" class="form1" 
									value='<bean:write name="userForm" property="first_name"/>'/></td>
									<td class="formText">Last Name<font class="asterix">*</font></td>
									<td><input type="text" name="last_name" id="last_name" class="form1"
									value='<bean:write name="userForm" property="last_name"/>'/></td>
								</tr>
								<tr>
									<td>&nbsp;</td>
									<td class="formText">User Name<font class="asterix">*</font></td>
									<td><input type="text" name="user_name" id="user_name" class="form1"
									value='<bean:write name="userForm" property="user_name"/>' readonly="readonly"/></td>
									<td class="formText">Exam Type</td>
									<td>
										<html:select property="exam_type" styleId="exam_type" styleClass="form3">
										<html:option value="">--Please Select--</html:option>
										<logic:present name="userForm" property="exam_type_list">
										<logic:iterate name="userForm" property="exam_type_list" id="examType" >
										<bean:define id="dID" name="examType" property="id" />
										<html:option  value="<%=dID.toString()%>"><bean:write name="examType" property="name"/></html:option>		
										</logic:iterate>
										</logic:present>
										</html:select>
									</td>	
								</tr>
								<tr>
									<td>&nbsp;</td>
								    <td class="formText">Emp. Code/Role No.</td>
								    <td ><input type="text" name="emp_code" id="emp_code" class="form1" 
								    	value='<bean:write name="userForm" property="emp_code"/>'/></td>
								    <td class="formText">Mobile</td>
								    <td><input type="text" name="mobile" id="mobile" class="form1" 
								    	value='<bean:write name="userForm" property="mobile"/>'/></td>
								    <td>&nbsp;</td>
								</tr>
								<tr>
								    <td>&nbsp;</td>
								    <td class="formText">Email ID</td>
								    <td><input type="text" name="email" id="email" class="form1" 
								    	value='<bean:write name="userForm" property="email"/>'/></td>
								    <td class="formText">Gender</td>
								    <td><html:select styleClass="form2" property="gender" styleId="gender" >
											<html:option value="Male">Male</html:option>
											<html:option value="Female">Female</html:option>
										</html:select></td>
								    <td>&nbsp;</td>
  								</tr>
								<tr>
									<td>&nbsp;</td>
									<td class="formText">User Type</td>
									<td>
										<html:select styleClass="form2" property="user_type" styleId="user_type" disabled="true">
											<html:option value="1">Examiner</html:option>
											<html:option value="2">Examinee</html:option>
										</html:select>
									</td>
									<td class="formText">Status</td>
									<td>
										<html:select styleClass="form2" property="status" styleId="status">
											<html:option value="1">Active</html:option>
											<html:option value="2">InActive</html:option>
										</html:select>
									</td>
								</tr>
								<logic:notEqual name="userForm" property="score" value="">
								<tr>
									<td colspan="6">&nbsp;</td>
								</tr>
								<tr>
									<td>&nbsp;</td>
									<td class="style7" colspan="6">
									<!-- HTML codes by Quackit.com -->
<marquee behavior="scroll" scrollamount="1" direction="up">Scored : <b><bean:write name="userForm" property="score"/></b> out of <b><bean:write name="userForm" property="userInfo.examType.passingMarks"/></b> in  <b><bean:write name="userForm" property="userInfo.examType.name"/></b> Exam</marquee>

</td>						
								</tr>
								</logic:notEqual>
								<logic:equal name="userForm" property="screen_type" value="Edit">
								<tr>
			       	 				<td height="25" colspan="5" align="center" valign="top">
			       	 					<input type="button" class="imageButton" value="Submit" onClick="JavaScript:fnUpdate()">
			       	 				</td>
			      				</tr>
			      				</logic:equal>
			      				<tr>
									<td height="100" colspan="5" align="center" valign="top" >&nbsp;</td>
								</tr>								
							</table>
          				</td>
					</tr>
					 <tr>
					<td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td class="lowerCorner1"></td>
								<td class="lowerbg" width="800px" colspan="3" >&nbsp;</td>
								<td class="lowerCorner2"></td>
							  </tr>
							  </table>
					</td>
					</tr>
      			</table>
      		</td>
      	</tr>		
      </table> 			
      <logic:equal name="userForm" property="screen_type" value="View">
		<script language="JavaScript">	
			var elements = document.forms[0].elements;
			var type = "";
			for(j=0;j<elements.length;j++){
				type = elements[j].type;
				if(type == 'text' || type == 'select-one' || type == 'radio' || type == 'checkbox' || type == 'button' || type == 'textarea') {
					elements[j].disabled=true;
				}
			}
		</script>
	</logic:equal>
</html:form>